import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
// 配置路由信息
const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    name: 'login',
    path: '/login',
    component: () => import('/@/views/login/index.vue'),
  },
  {
    name: 'home',
    path: '/home',
    component: () => import('/@/views/home/index.vue'),
    redirect: '/home/problemView',
    children: [
      {
        path: 'problemView',
        component: () => import('/@/views/oj/ProblemsView.vue'),
        // redirect: "/menu/menu1/menu1-1",
        name: 'ProblemsView',
        meta: {
          title: 'OJ系统首页',
          keepAlive: true,
        },
      },
      {
        path: 'addProblem',
        component: () => import('/@/views/oj/AddProblemView.vue'),
        // redirect: "/menu/menu1/menu1-1",
        name: 'addProblemView',
        meta: {
          title: 'OJ系统首页',
          keepAlive: true,
        },
      },
      {
        path: 'problemSubmit/:id',
        component: () => import('/@/views/oj/ProblemSubmit.vue'),
        // redirect: "/menu/menu1/menu1-1",
        name: 'ProblemSubmit',
        meta: {
          title: 'OJ问题提交系统',
          keepAlive: true,
        },
      },

      {
        path: 'problemSubmitView/',
        component: () => import('/@/views/oj/ProblemSubmitView.vue'),
        name: 'ProblemSubmitView',
        meta: {
          title: 'OJ提交信息查看',
          keepAlive: true,
        },
      },
    ],
  },

  {
    name: 'store',
    path: '/store',
    component: () => import('/@/views/store/index.vue'),
  },
  {
    name: 'main',
    path: '/main',
    component: () => import('/@/views/main/MainPage.vue'),
    redirect: '/main/dashboard/workplace',
    children: [],
  },
  {
    name: 'request',
    path: '/request',
    component: () => import('/@/views/request/index.vue'),
  },
  {
    name: 'watermark',
    path: '/watermark',
    component: () => import('/@/views/watermark/index.vue'),
  },
]

const router = createRouter({
  routes,
  history: createWebHistory(),
})

export default router
